#include "fruit.h"


Fruit::Fruit() : FixedUnit()
{
    setLives(1);
}

Fruit::Fruit(QRect &geometry) : FixedUnit(geometry)
{
    setLives(1);
}

int Fruit::getType() const {return Unit::Fruit;}


void Fruit::init()
{
    m_sprite = "fruit1";
    loadPixmaps();
}

void Fruit::draw(QPainter *painter)
{
    /*
    painter->fillRect(this->m_geometry, Qt::green);
    painter->setPen(Qt::white);
    painter->drawText(m_geometry.center().x(), m_geometry.center().y(), "F");
    */
    painter->drawPixmap(this->m_geometry, this->m_pixmaps[0][0]);
}


void  Fruit::serializeDebug(QDebug &dbg)
{
    dbg << "Fruit (";
    FixedUnit::serializeDebug(dbg);
    dbg << ")";
}

void  Fruit::serializeIn(QDataStream &in)
{
    FixedUnit::serializeIn(in);
    init();
}

void Fruit::serializeOut(QDataStream &out)
{
    FixedUnit::serializeOut(out);
}
